<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html  xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <h:form>
            <p:panel>
                <h:panelGrid columns="2" >
                    <h:outputText value="Project ID :"/>
                    <h:outputText value="#{projectController.selected.prID}" title="ProjectID"/>
                    <h:outputText value="Order ID :"/>
                    <h:outputText value="#{projectController.selected.odID}" title="OrderID"/>                
                    <h:outputText value="State :"/>
                    <h:outputText value="#{projectController.selected.prState}" title="State"/> 
                    <h:outputText value="URL Image :"/>
                    <h:outputText value="#{projectController.selected.pdImageURL}" title="URLImage"/> 
                    <h:outputText value="Created Date :"/>
                    <h:outputText value="#{projectController.selected.prCreated}" title="Created Date"> 
                        <f:convertDateTime pattern="MM/dd/yyyy " />
                    </h:outputText>
                    <h:outputText value="Completed Date :"/>
                    <h:outputText value="#{projectController.selected.prCompleted}" title="Completed Date"> 
                        <f:convertDateTime pattern="MM/dd/yyyy " />
                    </h:outputText>
                    <h:outputText value="ManagerID :"/>
                    <h:outputText value="#{projectController.selected.mnID}" title="ManagerID"/>
                    <h:outputText value="ManagerName"/>
                    <p:commandLink id="ManagerDetail" value="#{projectController.selected.mnID.mnName}" title="ManagerID" />                
                </h:panelGrid>

            </p:panel>
            <p:overlayPanel id="DetailsManagerPanel" for="ManagerDetail" hideEffect="fade" dynamic="true">  
                <h:panelGrid columns="2" >
                    <h:outputText value="ID :"/>
                    <h:outputText value="#{projectController.selected.mnID.mnID}" title="ID"/>
                    <h:outputText value="Name :"/>
                    <h:outputText value="#{projectController.selected.mnID.mnName}" title="Name"/>
                    <h:outputText value="UserName"/>
                    <h:outputText value="#{projectController.selected.mnID.mnUserName}" title="UserName"/>
                    <h:outputText value="Email :"/>
                    <h:outputText value="#{projectController.selected.mnID.mnEmail}" title="Email"/>
                    <h:outputText value="Address :"/>
                    <h:outputText value="#{projectControllerr.selected.mnID.mnAdress}" title="Address"/>
                    <h:outputText value="Phone :"/>
                    <h:outputText value="#{projectController.selected.mnID.mnPhone}" title="Phone"/>  
                    <h:outputText value="Permission :"/>
                    <h:outputText value="#{projectController.selected.mnID.mnPermission}" title="Permission"/>   
                </h:panelGrid>
            </p:overlayPanel> 
            <br />
            <br />
        </h:form>
        <h:form id="form2">
            <h:panelGroup>
                <p:growl id="messages" showDetail="true"/> 
                <p:dataTable id="dataTable" var="i" value="#{projectController.selected.tblProjectDetailList}" editable="true"
                             paginator="true" rows="5" paginatorPosition="bottom" resizableColumns="true"
                             paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                             rowsPerPageTemplate="5,10,15" style="width: 50%" widgetVar="projectDetailTable">	
                    <f:facet name="header">
                        <h:outputText value="ProjectDetail"/>
                    </f:facet>
                    <p:ajax event="rowEdit" listener="#{projectDetailController.onEdit}" update=":form2:messages"/>
                    <p:ajax event="rowEditCancel" listener="#{projectDetailController.onEditCancel}" />
                    <p:column sortBy="#{i.tblProjectDetailPK.prID}" headerText="Project ID" >                    
                        <p:cellEditor> 
                            <f:facet name="output">  
                                <h:outputText value="#{i.tblProjectDetailPK.prID}"/>                          
                            </f:facet>
                            <f:facet name="input">  
                                <h:outputText value="#{i.tblProjectDetailPK.prID}"/> 
                            </f:facet>
                        </p:cellEditor>
                    </p:column>

                    <p:column sortBy="#{i.elID.elName}" headerText="Elevation" >
                        <p:cellEditor> 
                            <f:facet name="output">  
                                <h:outputText value="#{i.elID.elName}"/>
                            </f:facet>
                            <f:facet name="input">  
                                <p:selectOneMenu value="#{item.elID}">                                
                                    <f:selectItems value="#{elevationController.itemsAvailableSelectOne}"/>
                                </p:selectOneMenu>
                            </f:facet>
                        </p:cellEditor>
                    </p:column>
                    <p:column  headerText="Working Name">
                        <p:cellEditor>  
                            <f:facet name="output">  
                                <h:outputText value="#{i.wkID.wkName}"/>
                            </f:facet>
                            <f:facet name="input">  
                                <p:selectOneMenu id="prState" value="#{i.wkID}">               
                                    <f:selectItems value="#{workingController.itemsAvailableSelectOne}"/>
                                </p:selectOneMenu>

                            </f:facet>
                        </p:cellEditor>

                    </p:column>
                    <p:column style="width:6%">  
                        <p:rowEditor />  
                    </p:column> 
                </p:dataTable>
            </h:panelGroup>

            <br/>
            <br/>

            <p:commandButton action="#{projectController.prepareCreate()}" value="Create New Project" />
            <p:commandButton action="#{projectController.prepareList}" value="Show All Project"/>
        </h:form>
    </h:body>
</html>

